$(function() {
	$('#vue_vm_list div').hide();
});

var department = {
	departmentId: '',
	departmentName: '',
	unitName: '',
	function: '',
	telPhone: '',
	address: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
	remark: '',
};

var view = {
	data: department
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

findAll();

function save() {
	save_basic(path+'/department/save', {department:view.data}, function() {
		alert('保存成功');
		findAll();
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/department/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/department/deleteBatch');
}
